Programatically clicking a HTML button by vb.net [closed]
        Posted  
        
            by 
                Chauhdry King
            
        on Programmers
        
        See other posts from Programmers
        
            or by Chauhdry King
        
        
        
        Published on 2012-06-19T16:13:08Z
        Indexed on 
            2012/06/19
            21:23 UTC
        
        
        Read the original article
        Hit count: 446
        
vb.net
I have to click a HTML button programatically which is on the 3rd page of the website. The button is without id. It has just name type and value. The HTML code of the button is given below
<FORM NAME='form1' METHOD='post' action='/dflogin.php'> <INPUT TYPE='hidden' NAME='txtId' value='E712050-15'><INPUT TYPE='hidden' NAME='txtassId' value='1'><INPUT TYPE='hidden' NAME='txtPsw'  value='HH29'><INPUT TYPE='hidden' NAME='txtLog' value='0'><h6 align='right'><INPUT TYPE='SUBMIT' NAME='btnSub' value='Next' style='background-color:#009900; color:#fff;'></h6></FORM>
I am using the following code to click it
Dim i As Integer
Dim allButtons As HtmlElementCollection
allButtons = WebBrowser1.Document.GetElementsByTagName("input")
i = 0
For Each webpageelement As HtmlElement In allButtons
    i += 1
    If i = 5 Then
        webpageelement.InvokeMember("click")
    End If
Next
But I am not able to click it. I am using the vb.net 2008 platform. Can anyone tell me the solution to click it?
© Programmers or respective owner